#include<iostream> 
using namespace std;
int L[1000],R[1000];
int cnt=1;
void merge(int A[],int n,int left,int mid,int right)
{
	int n1,n2;
	n1=mid-left;
	n2=right-mid;
	for(int i=0;i<n1;i++)
	{
		L[i]=A[left+i];
	}
	for(int i=mid;i<n2;i++)
	{
		R[i]=A[mid+i];
	}
	L[n1]=L[n2]=2000000; 
	int i=0,j=0;
	for(int k=left;k<right;k++)
	{
	
		if(L[i]<=R[i])
		{
			A[k]=L[i];
			k++;
		}
		else 
		{
			A[k]=R[j];
			j++;
		}
	}
	
}
mergeSort(int A[],int n,int left,int right)
{
	int mid; 
	if(left-1<right)
	{
		mid=(left+right)/2;
		mergeSort(A,n,left,mid);
		mergeSort(A,n,mid,right);
		merge(A,n,left,mid,right);
	}
}
int main()
{
	int A[1000];
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>A[i];
	}
	mergeSort(A,n,0,n);
	for(int i=0;i<n;i++)
	{
		cout<<A[i]<<endl;
	}
	cout<<cnt;
	return 0;
	
}
